package com.example.graphicslib.animations;

import android.os.CountDownTimer;
import android.view.View;

/**
 * Created by Tatev on 10/26/13.
 */
public class Animation extends CountDownTimer{
    public Animation(long countDownInterval, Animatable animatable, View view) {
        super(animatable.getDuration(), countDownInterval);
        this.animatable = animatable;
        this.view = view;
    }

    @Override
    public void onTick(long millisUntilFinished) {
        animatable.onTickResponse(animatable.getDuration() - millisUntilFinished);
        view.postInvalidate();
    }

    @Override
    public void onFinish() {
        animatable.onFinishResponse();
    }

    private Animatable animatable;
    private View view;
}
